import { Component, OnInit, Input, EventEmitter, Output, Host, Inject, forwardRef, ViewChild, ElementRef, AfterViewInit } from '@angular/core';
import { RolesComponent } from '../roles.component';
import * as moment from 'moment';
import { Service } from '../../../server/server';

@Component({
  selector: 'app-roles-details',
  templateUrl: './roles-details.component.html',
})
export class RolesDetailsComponent implements OnInit {

  @Input() getTabVal: any;

  constructor(private server: Service, @Host() @Inject(forwardRef(() => RolesComponent)) roles: RolesComponent) { }

  ngOnInit() {
    //console.log(this.getTabVal)
  }

  ngDoCheck() {
    if (this.getTabVal) {
      if (this.getTabVal.createDate != null) {
        this.getTabVal.createDate = moment(this.getTabVal.createDate).format('YYYY-MM-DD HH:mm:ss');
      } else {
        this.getTabVal.createDate = null;
      }
      if (this.getTabVal.lastUpdatedDate != null) {
        this.getTabVal.lastUpdatedDate = moment(this.getTabVal.lastUpdatedDate).format('YYYY-MM-DD HH:mm:ss')
      } else {
        this.getTabVal.lastUpdatedDate = null;
      }

    }
  }

}
